import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "Error")
public class Error extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 设置响应内容类型
        response.setContentType("text/html");
        // 编码问题
        response.setCharacterEncoding("utf-8");
        // 获取响应输出流  是个流
        PrintWriter out = response.getWriter();
        System.out.println("你好");
        out.println("<html>");
        out.println("<head>");
        out.println("<title>404 NOT FOUND</title>");
        out.println("</head>");

        out.println("<body>");
        /*配置一个404页面*/
        out.println("<h1> 404 NOT FOUND 页面未找到</h1>");
        out.println("</body>");
        out.println("</html>");
    }
}
